<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>迅腾报表后台管理</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="__WZHPUBLIC__admin/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="__WZHPUBLIC__admin/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="__WZHPUBLIC__admin/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="__WZHPUBLIC__admin/assets/css/admin.css">
    <link rel="stylesheet" href="__WZHPUBLIC__admin/assets/css/app.css">
    <style type="text/css">
        .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
        .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
        .pagination .active{background-color: #dd1a20;color: #fff;}
        .pagination .disabled{color:#aaa;}
    </style>
</head>

<body data-type="generalComponents">

        {include file='Public:header'}

        {include file='Public:menu'}


        <div class="tpl-content-wrapper">

            <ol class="am-breadcrumb">
                <li><a href="#" class="am-icon-home">首页</a></li>
                <li><a href="{:url('admin/Index/index')}">项目管理</a></li>
                <li class="am-active">项目列表</li>
            </ol>
            <div class="tpl-portlet-components">

                <div class="tpl-block">
                    <div class="am-g">
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-default am-btn-success" onclick="add()"><span class="am-icon-plus"></span> 新增</button>

                                </div>
                            </div>
                        </div>
                        <form action="{:url('admin/Index/index')}" method="get">
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                <select id="completion" name="completion"  data-am-selected="{btnSize: 'sm'}">
                                    <option value="-1">所有状态</option>
                                      <option value="1">跟踪</option>
                                      <option value="2">在建</option>
                                      <option value="3">完工</option>
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                <select id="type" name="type" data-am-selected="{btnSize: 'sm'}">
                                    <option value="-1">所有类别</option>
                                    <option value="1">电网</option>
                                    <option value="2">市政</option>
                                    <option value="3">商业</option>
                                    <option value="4">新源</option>
                                    <option value="5">挂靠</option>
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-input-group am-input-group-sm">
                                <input name="search" type="text" class="am-form-field">
                                <span class="am-input-group-btn">
            <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" ></button>
          </span>
                            </div>
                        </div>
                        </form>
                    </div>
                    <div class="am-g">
                        <div class="am-u-sm-12">
                            <form class="am-form">
                                <table class="am-table am-table-striped am-table-hover table-main " style="font-size:1.2rem">
                                    <thead>
                                        <tr>
                                            <th class="table-title">订单编号</th>
                                            <th class="table-title">标题</th>
                                            <th class="table-title">业主单位</th>
                                            <th class="table-type">订单状态</th>
                                            <th class="table-type">订单类别</th>
                                            <th class="table-title">项目负责人</th>
                                            <th class="table-date am-hide-sm-only">创建时间</th>
                                            <th class="table-date am-hide-sm-only">修改时间</th>
                                            <th class="table-set">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    {foreach name="res" item="k"}
                                        <tr>
                                            <td>{$k.order}</td>
                                            <td><a href="{:url('admin/Index/details')}?id={$k.id}">{$k.title}</a></td>
                                            <td>{$k.unit}</td>


                                            {switch name=$k.is_completion}
                                            {case value="1"}  <td>跟踪</td>{/case}
                                            {case value="2"}  <td>在建</td>{/case}
                                            {case value="3"}  <td>完成</td>{/case}
                                            {/switch}
                                            {switch name=$k.type}
                                            {case value="1"} <td>电网</td>{/case}
                                            {case value="2"} <td>市政</td>{/case}
                                            {case value="3"} <td>商业</td>{/case}
                                            {case value="4"} <td>新源</td>{/case}
                                            {case value="5"} <td>挂靠</td>{/case}
                                            {/switch}
                                            <td>{$k.leader}</td>
                                            <td class="am-hide-sm-only">{:date('Y-m-d ',$k.create_time)}</td>
                                            <td class="am-hide-sm-only">{:date('Y-m-d ',$k.update_time)}</td>
                                            <td>
                                                <div class="am-btn-toolbar">
                                                    <div class="am-btn-group am-btn-group-xs">
                                                        <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="edit({$k.id})"><span class="am-icon-pencil-square-o"></span> 更新</button>
                                                        <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="delone({$k.id})"><span class="am-icon-trash-o"></span> 删除</button>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    {/foreach}
                                    </tbody>
                                </table>
                                <div class="am-cf">


                                    {$res->render()|raw}


                                </div>
                                <hr>

                            </form>
                        </div>

                    </div>
                </div>
                <div class="tpl-alert"></div>
            </div>










        </div>

    </div>

        <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
        <script src="__WZHPUBLIC__admin/assets/js/jquery.min.js"></script>
        <script src="__WZHPUBLIC__admin/assets/js/amazeui.min.js"></script>
        <script src="__WZHPUBLIC__admin/assets/js/app.js"></script>
        <script type="text/javascript">
            function delone($k) {
               if (confirm('确定要删除这条信息吗？')){
                   $.ajax({
                       type:"get",
                       url:"{:url('admin/Index/delone')}",
                       async:true,
                       data:{
                            'id': $k
                        },
                       dataType:"json",
                       success:function (xhr) {
                           // console.log(xhr);
                           if (xhr.code == 1) {
                               alert('删除成功');
                           }
                           else {
                               alert('删除失败请检查您所选择的目标');
                           }
                            window.location.href="{:url('admin/Index/index')}";

                       },
                       error:function () {
                           alert('请求超时，请检查你的网络')
                       }
                   });
               }
            }
            function add() {
                window.location.href="{:url('admin/Index/add')}";
            }
            function  edit($k) {
                window.location.href="{:url('admin/Index/edit')}?id="+$k;
            }



        </script>
</body>

</html>